package com.education.platform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.education.platform.entity.AiMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * AI消息表 Mapper 接口
 */
@Mapper
public interface AiMessageMapper extends BaseMapper<AiMessage> {

    /**
     * 根据会话ID查询消息列表
     */
    List<AiMessage> selectByConversationId(@Param("conversationId") Long conversationId);

    /**
     * 查询会话最新的N条消息
     */
    List<AiMessage> selectLatestMessages(@Param("conversationId") Long conversationId, @Param("limit") Integer limit);
}

